package com.foreknow.demo4;

import java.util.Scanner;

public class ArrayDemo3 {
    public static void main(String[] args) {
        System.out.println("请输入要计算的数字");
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int resNum =  ArrayDemo3.addNum(n);
        System.out.println(resNum);
    }
    public static int addNum(int a){
        int sum = 0;
        for (int i = 1; i < a;i++){
            if (i%2==0){
                sum+=i;
            }
        }
        return sum;
    };
}
